{% extends "cms/base.html" %}

{% block title -%}
  编辑员工
{%- endblock %}

{% block head %}
{% endblock %}

{% block page_title -%}
  {{ self.title() }}
{%- endblock %}

{% block main_content %}
  <form action="" method="post">
    <div class="form-container">
      <div class="form-group form-inline">
        <label for="email">邮箱：</label>
        <input id="email" type="email" class="form-control" name="email" placeholder="邮箱" readonly value="{{ user.email }}">
      </div>
      <div class="form-group">
        <label>员工：</label>
        <div class="form-check form-check-inline">
          {% if user.is_staff %}
            <input class="form-check-input" type="radio" name="is_staff" id="staff1" value="1" checked>
          {% else %}
            <input class="form-check-input" type="radio" name="is_staff" id="staff1" value="1">
          {% endif %}
          <label class="form-check-label" for="staff1" name="is_staff">是</label>
        </div>
        <div class="form-check form-check-inline">
          <input class="form-check-input" type="radio" name="role" id="staff0" value="0">
          <label class="form-check-label" for="staff0">否</label>
        </div>
      </div>
      <div class="form-group">
        <label>角色：</label>
        {% for role in roles %}
          <div class="form-check form-check-inline">
            {% if user.role.id == role.id %}
              <input class="form-check-input" type="radio" name="role" id="inlineRadio{{ loop.index }}" value="{{ role.id }}" checked>
            {% else %}
              <input class="form-check-input" type="radio" name="role" id="inlineRadio{{ loop.index }}" value="{{ role.id }}">
            {% endif %}
            <label class="form-check-label" for="inlineRadio{{ loop.index }}">{{ role.name }}</label>
          </div>
        {% endfor %}
      </div>
      <div class="form-group">
        <button class="btn btn-primary" id="submit">立即添加</button>
      </div>
    </div>
  </form>
{% endblock %}